<template>
    <fieldset>
        <legend>商品页面</legend>
        <ul>
            <li v-for="item in arr" :key="item.id">
                <b>商品信息:{{item.title}}</b>
                ---
                <b>商品价格:{{item.price}}</b>
                ---
                <b>商品库存:{{item.inventory}}</b>
                ---
                <button :disabled="item.inventory===0" @click="SETMSG(item)">+添加到购物车</button>
            
            </li>
        </ul>


    </fieldset>
</template>
<script>
import { mapActions,mapState } from 'vuex'
    export default{
        methods:{
            ...mapActions('goods',['GETMSG']),
            ...mapActions('packages',['SETMSG'])
        },
        mounted(){
            this.GETMSG()
            // console.log(this.arr);
            // console.log(this.arr);
        },
        computed:{
            ...mapState('goods',['arr'])
        }
    }




</script>